export default{
	methods:{
		get_time() { // 设置时间
			let t_day = this.get_number_time(0) //今天
			this.time_list[0].name = t_day.year
			this.time_list[1].name =  `${t_day.month}-${t_day.today}`
			this.time_list[1].time = `${t_day.year}${t_day.month}${t_day.today}`
			this.time_list[1].date = `${t_day.year}-${t_day.month}-${t_day.today}`
			
			let m_day = this.get_number_time(1) //明天
			this.time_list[2].name = `${m_day.month}-${m_day.today}`
			this.time_list[2].time = `${m_day.year}${m_day.month}${m_day.today}`
			this.time_list[2].date = `${m_day.year}-${m_day.month}-${m_day.today}`
			
			let o_day = this.get_number_time(2) //后天
			this.time_list[3].title = o_day.day
			this.time_list[3].name = `${o_day.month}-${o_day.today}`
			this.time_list[3].time = `${o_day.year}${o_day.month}${o_day.today}`
			this.time_list[3].date = `${o_day.year}-${o_day.month}-${o_day.today}`
		},
		get_number_time(number,type){
			const date = new Date(new Date().getTime() + (86400000 * number)) //几天
			let year = date.getFullYear() > 9 ? date.getFullYear() : "0" + date.getFullYear()
			let month = date.getMonth() + 1 > 9 ? date.getMonth() + 1 : "0" + (date.getMonth() + 1)
			let today = date.getDate() > 9 ? date.getDate() : "0" + date.getDate()
			let hours = date.getHours() > 9 ? date.getHours() : "0" + date.getHours()
			let minutes = date.getMinutes() > 9 ? date.getMinutes() : "0" + date.getMinutes()
			let seconds = date.getSeconds() > 9 ? date.getSeconds() : "0" + date.getSeconds() 
			let data = {
				year,
				month,
				today,
				day:this.get_day(date.getDay()) // 周几
			}
			if(type){
				data = `${year}-${month}-${today} ${hours}:${minutes}:${seconds}`
			}
			return data
		},
		get_now_time(){
			let t_day = this.get_number_time(0,'s') //今天
			return t_day
		},
		get_day(val) { // 星期几
			switch (val) {
				case 0:
					return '周日';
				case 1:
					return '周一';
				case 2:
					return '周二';
				case 3:
					return '周三';
				case 4:
					return '周四';
				case 5:
					return '周五';
				case 6:
					return '周六';
			}
		},
		
	}
}